import React, {Component} from 'react';
import cs from 'classnames';
import BaseCmpt from '../BaseCmpt';
import './index.css';

class ShopInfoRow extends BaseCmpt {

    static defaultProps = {
        data: {
            type: 110,
            style: {},
            dataset: {},
            layout: {
                isLx: true,
                isQd: false,
                isKf: true,
                isDz: true,
            },
        }
    };

    constructor(props) {
        super(props);
    }

    render() {
        var {onSelected, selected, data} = this.props;
        var {style, dataset, layout} = data;

        layout = layout || {
                isLx: true,
                isQd: false,
                isKf: true,
                isDz: true
            };

        return (
            <div
                onClick={(e) => {
                    onSelected && onSelected(e)
                }}
                className={cs({'shopInfoRow cmptEle': true, 'cmptEle_selected': selected})}
                style={style}
            >
                <div className="shopInfoRow__logo">
                    <img src={dataset.logo} alt="" className="shopInfoRow__logo__img"/>
                    <div className="shopInfoRow__logo__text">{dataset.name}</div>
                </div>
                <div className="shopInfoRow__content">
                    {
                        layout.isLx ?
                            (
                                <div className="shopInfoRow__item">
                                    <img src="/asset/admin/images/editor/shopInfoRow/phone.png" alt=""
                                         className="shopInfoRow__item__icon"/>
                                    <div className="shopInfoRow__item__text">联系我们</div>
                                </div>
                            )
                            : null
                    }
                    {
                        layout.isQd ?
                            (
                                <div className="shopInfoRow__item">
                                    <img src="/asset/admin/images/editor/shopInfoRow/sign.png" alt=""
                                         className="shopInfoRow__item__icon"/>
                                    <div className="shopInfoRow__item__text">签到有礼</div>
                                </div>
                            )
                            : null
                    }
                    {
                        layout.isKf ?
                            (
                                <div className="shopInfoRow__item">
                                    <img src="/asset/admin/images/editor/shopInfoRow/kf.png" alt=""
                                         className="shopInfoRow__item__icon"/>
                                    <div className="shopInfoRow__item__text">客服</div>
                                </div>
                            )
                            : null
                    }
                    {
                        layout.isDz ?
                            (
                                <div className="shopInfoRow__item">
                                    <img src="/asset/admin/images/editor/shopInfoRow/addr.png" alt=""
                                         className="shopInfoRow__item__icon"/>
                                    <div className="shopInfoRow__item__text">地址导航</div>
                                </div>
                            )
                            : null
                    }
                </div>
            </div>
        );
    }
}

export default ShopInfoRow;
